package com.siao.example.libaray.display.controller
{
	import com.siao.applications.ApplicationManager;
	import com.siao.example.libaray.Libaray;
	import com.siao.example.libaray.display.method.DisplayMethod;
	import com.siao.example.libaray.display.state.DisplayImageState;
	import com.siao.example.libaray.display.state.DisplayLayoutState;
	import com.siao.example.libaray.display.state.DisplayTextState;
	import com.siao.mvc.Controller;
	import com.siao.mvc.notice.Notice;
	
	/**
	 * 显示控制器
	 * @author SiaoLeon
	 */
	public class DisplayController extends Controller
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function DisplayController()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			this.register(DisplayMethod.ENTER_DISPLAY_TEXT, ENTER_TEXT_EXAMPLE);
			this.register(DisplayMethod.ENTER_DISPLAY_LAYOUT, ENTER_LAYOUT_EXAMPLE);
			this.register(DisplayMethod.ENTER_DISPLAY_BITMAP, ENTER_BITMAP_EXAMPLE);
		}
		
		// -------------------------------------------------------------------------------------------------------- 函数
		
		private function ENTER_TEXT_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(DisplayTextState);
		}
		
		private function ENTER_LAYOUT_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(DisplayLayoutState);
		}
		
		private function ENTER_BITMAP_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(DisplayImageState);
		}
	
	}
}
